export const formatTime = (date: Date) => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return (
    [year, month, day].map(formatNumber).join('/') +
    ' ' +
    [hour, minute, second].map(formatNumber).join(':')
  )
}

const formatNumber = (n: number) => {
  const s = n.toString()
  return s[1] ? s : '0' + s
}

export const generateList = (childCount) => {
  const ans = []
  for (let i = 0; i < childCount; i++) {
    ans.push({
      id: i,
      color: lightBlue[`${100 * (i % 9)}`],
    })
  }
  return ans
}

function getRandomInt(max) {
  return Math.floor(Math.random() * max)
}

export const generateGridList = (childCount, columns) => {
  const ans = []
  for (let i = 0; i < childCount; i++) {
    ans.push({
      id: i,
      sub: "你好_"+getRandomInt(columns) + 1,
    })
  }
  return ans
}

export const createTabViewListAndPageGridList = (childCount) => {
  // const ans = []
  // for (let i = 0; i < childCount; i++) {
  //   ans.push({
  //     id: i,
  //     sub: "你好_"+getRandomInt(columns) + 1,
  //   })
  // }
  return childCount
}

// // 计算地图两点间距离
// export const mapDistance = (childCount:number) => {
//   return childCount+1;
// }
